package com.ruoyi.project.gzbook.recommand.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.gzbook.recommand.mapper.DgWeekRecommandMapper;
import com.ruoyi.project.gzbook.recommand.domain.DgWeekRecommand;
import com.ruoyi.project.gzbook.recommand.service.IDgWeekRecommandService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 每周推荐Service业务层处理
 * 
 * @author mhg
 * @date 2021-10-06
 */
@Service
public class DgWeekRecommandServiceImpl implements IDgWeekRecommandService 
{
    @Autowired
    private DgWeekRecommandMapper dgWeekRecommandMapper;

    /**
     * 查询每周推荐
     * 
     * @param id 每周推荐主键
     * @return 每周推荐
     */
    @Override
    public DgWeekRecommand selectDgWeekRecommandById(Long id)
    {
        return dgWeekRecommandMapper.selectDgWeekRecommandById(id);
    }

    /**
     * 查询每周推荐列表
     * 
     * @param dgWeekRecommand 每周推荐
     * @return 每周推荐
     */
    @Override
    public List<DgWeekRecommand> selectDgWeekRecommandList(DgWeekRecommand dgWeekRecommand)
    {
        return dgWeekRecommandMapper.selectDgWeekRecommandList(dgWeekRecommand);
    }

    /**
     * 新增每周推荐
     * 
     * @param dgWeekRecommand 每周推荐
     * @return 结果
     */
    @Override
    public int insertDgWeekRecommand(DgWeekRecommand dgWeekRecommand)
    {
        dgWeekRecommand.setCreateTime(DateUtils.getNowDate());
        return dgWeekRecommandMapper.insertDgWeekRecommand(dgWeekRecommand);
    }

    /**
     * 修改每周推荐
     * 
     * @param dgWeekRecommand 每周推荐
     * @return 结果
     */
    @Override
    public int updateDgWeekRecommand(DgWeekRecommand dgWeekRecommand)
    {
        return dgWeekRecommandMapper.updateDgWeekRecommand(dgWeekRecommand);
    }

    /**
     * 批量删除每周推荐
     * 
     * @param ids 需要删除的每周推荐主键
     * @return 结果
     */
    @Override
    public int deleteDgWeekRecommandByIds(String ids)
    {
        return dgWeekRecommandMapper.deleteDgWeekRecommandByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除每周推荐信息
     * 
     * @param id 每周推荐主键
     * @return 结果
     */
    @Override
    public int deleteDgWeekRecommandById(Long id)
    {
        return dgWeekRecommandMapper.deleteDgWeekRecommandById(id);
    }
}
